/**
 * @author cookie
 * @param {array[]} num1
 * @param {array[]} num2
 * @return {number} 
 */



//  获取两个正序数组中的中位数
 function findMedianSortedArrays(num1, num2){
     num1 = [...num1, ...num2]
    num1.sort((a, b) => a -b)
    // console.log(num1);
    if(num1.length %2 === 0 ) {
        var index = num1.length/2 -1
        return (num1[index] + num1[index+1])/2
    }else {
        var index = Math.floor(num1.length/2)
        return num1[index]
    }
 }


 const num1 = [1, 3, 5,5,100000,1,6]
 const num2 = [8, 10,10000000]
 const result = findMedianSortedArrays(num1, num2)
 console.log(result);
